/****************************************
js异步编程实现
****************************************/

async function test(): Promise<void> {
    console.log(1);
    function fn() {
        return new Promise<void>((resolve) => {
            setTimeout(() => {
                console.log(2);
                resolve();
            }, 3000);
        });
    }
    await fn();
    console.log(3);
}
test();
